package com.eryos.android.cigarettecounter.ui;

/**
 * Project :  CigaretteCounter
 * Author :   Olivier Combe 
 * URL :      http://eryos.fr/CigaretteCounter/
 *
 * Copyright (C) 2011 - Olivier Combe 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 *
 */

import android.app.Dialog;
import android.content.Context;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.webkit.WebView;
import android.widget.Button;

import com.eryos.android.cigarettecounter.R;

public class Credits extends Dialog{

	private final static String LOG_TAG = "ChartPopup";
	
	/* UI Elements */
	private Button 		closeButton;

	public Credits(Context _context) {
		super(_context);

		Log.w(LOG_TAG, getClass().getSimpleName()+" : new CreditsPopup()");

		this.setContentView(R.layout.credits_dialog);
		this.setTitle("Credits");


		WebView content = (WebView) findViewById(R.id.content_label);
		content.loadUrl("file:///android_asset/credits.html");

		closeButton  	= (Button) findViewById(R.id.popup_share_button);
		closeButton.setEnabled(true);

		this.show();

		/* Share button listener */
		closeButton.setOnTouchListener(new OnTouchListener() {
			public boolean onTouch(View v, MotionEvent e) {
				if ( e.getAction() == MotionEvent.ACTION_DOWN ) {
					dismiss();
					return false;
				}
				return true;
			}
		});
		
	}

}
